﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Aishow.IBLL;
using Aishow.BLL;
using Aishow.Common;

namespace Aishow.Website
{
    /// <summary>
    /// DiscussPublishHandler 的摘要说明
    /// </summary>
    public class DiscussPublishHandler : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            var videoId = context.Request.QueryString["id"];
            var discuss = new Aishow.Model.Discuss
            {
                AddTime = TimeHelper.GetTimeByUnix(long.Parse(context.Request.Form["AddTime"])),
                Avatar= context.Request.Form["Avatar"],
                Content= context.Request.Form["Content"],
                ReplayTo= context.Request.Form["ReplayTo"],
                NickName= context.Request.Form["NickName"]
            };
            IDiscussManager manager = new DiscussManager();
            manager.Add(videoId, discuss);
            //context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");
            context.Response.End();
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}